﻿using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using System.Collections.Generic;

[WebService ( Namespace = "http://tempuri.org/" )]
[WebServiceBinding ( ConformsTo = WsiProfiles.BasicProfile1_1 )]
[ScriptService]
public class returnjson_webservice : WebService
{

	[WebMethod]
	[ScriptMethod]
	public SortedDictionary<string, object> Save ( string name )
	{
		this.Context.Response.Cache.SetNoStore ( );

		SortedDictionary<string, object> values = new SortedDictionary<string, object> ( );
		values.Add ( "message", string.IsNullOrEmpty ( name ) ? "无名氏" : string.Format ( "你好 {0}, {1}", name, DateTime.Now ) );

		return values;
		/*
		 * .NET 2.0, 3.0 { "message": "..." }
		 * .NET 3.5, 4.0 { "d": { "message": "..." } }
		 * */
	}

}